

<h1><?php echo $this->titulo; ?></h1>



<a href="<?php echo $this->basePath() ?>/application/menu/add">Agregar</a>
<table class="table table-hover"  id="menuList">
    <thead>  
        <tr>  
            <th>ID</th>  
            <th>Titulo</th>  
            <th>Descripcion</th>  
            <th>Ver</th>  
            <th>Editar</th> 
            <th>Eliminar</th> 



        </tr>  
    </thead> 

    <tbody>   
        <?php
        foreach ($datos as $dato) {


            echo " <tr> ";
            echo "<td>";
            echo $dato["id"];
            echo "</td>";
            echo "<td>";
            echo $dato["titulo"];
            echo "</td>";
            echo "<td>";
            echo $dato["descripcion"];
            echo "</td>";

            echo "<td> <a href='";
            echo $this->basePath();
            echo "/application/menu/ver/";
            echo $dato["id"];
            echo "'>ver</a></td>";

            echo "<td> <a href='";
            echo $this->basePath();
            echo "/application/menu/edit/";
            echo $dato["id"];
            echo "'>Editar</a></td>";

            echo "<td>";
            echo "<button class='btn btn-danger' onclick='registroEliminar(" . $dato["id"] . ");' data-toggle='modal' data-target='#cofimationDelete'>";
            echo "Eliminar ";
            echo "</button>";
            echo "</td>";
            echo "</tr>";
        }
        ?>

    </tbody> 
</table>




<div id="error"></div>

<!-- Modal -->
<div class="modal fade" id="cofimationDelete" tabindex="-1" role="dialog" aria-labelledby="delete" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">ELIMINAR</h4>
            </div>
            <div class="modal-body">
                Esta seguro que quiere eliminar este registro?
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                <button type="button" class="btn btn-primary"  data-dismiss="modal"  onclick="confirmationEliminar();" >Eliminar</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->



<script type='text/javascript'>

                    var id = 0;
                    function registroEliminar(data) {
                        id = data;
                    }

                    function confirmationEliminar() {

                        $.ajax({
                            type: 'POST',
                            url: 'menu/delete/' + id,
                            // Mostramos un mensaje con la respuesta de PHP
                            success: function(data) {
                                $('#menuList').html(data);
                                $('#cofimationDelete').modal('hide');
                            },
                            error: function(data) {
                                $('#error').html("Error con el servidor");


                            }
                        });

                    }


</script>


<script type='text/javascript'>

                    var id = 0;
                    function registroEliminar(data) {
                        id = data;
                    }

                    function confirmationEliminar() {

                        $.ajax({
                            type: 'POST',
                            url: 'delete/' + id,
                            // Mostramos un mensaje con la respuesta de PHP
                            success: function(data) {
                                $('#menuList').html(data);
                                $('#cofimationDelete').modal('hide');
                            },
                            error: function(data) {
                                $('#error').html("Error con el servidor");


                            }
                        });

                    }


</script>



<!--<div id="grid"></div>
<script type='text/javascript'>
    $(function() {
        $("#menuList").kendoGrid({
            groupable: {
                messages: {
                    empty: "Arrastre un encabezado de columna y sueltalo aquí para agrupar por esa columna "
                }
            },
            scrollable: true,
            sortable: true,
            pageable: {
                refresh: true,
                pageSizes: true,
                pageSize: 10
            },
            columns: [{
                    field: "ID",
                    width: 20,
                    title: "ID"
                }, {
                    field: "Titulo",
                    width: 90
                }, {
                    field: "Descripcion",
                    width: 100
                }, {
                    field: "Ver",
                    width: 30
                }, {
                    field: "Editar",
                    width: 30
                },
                {
                    field: "Eliminar",
                    width: 30
                }
            ]


        });
    });
</script> -->